import { Entity, PrimaryUuid, UpdateDate, CreateDate, Openid, Code, PayType, PayStatus, Tags, Price, MemberId, DateTime, Remark, PayModule, Unique, Jsonb, Desc } from '@sker/core'
@Entity({ name: 'wx_payment_log' })
@Unique('UK_WX_PAYMENT_OUT_TRADE_NO', [`out_trade_no`])
export class WxPaymentLog {
    static title: string = `支付记录`;
    static resource: string = `wx_payment_log`;

    @PrimaryUuid({
        primaryKeyConstraintName: "PK_WX_PAYMENT_LOG_ID"
    })
    id!: string;

    @Code({ type: 'varchar', comment: '订单号', length: 32 })
    tid!: string;

    @Code({ type: 'varchar', comment: '微信支付编号', length: 32, default: '' })
    out_trade_no: string;

    @Desc({ default: '' })
    description: string;

    @Openid()
    openid!: string;

    @PayType({ type: 'varchar', comment: '支付类型', length: 20 })
    type!: string;

    @PayStatus({
        comment: '支付状态',
        nullable: true, default: `0`
    })
    status!: string;

    @PayModule({
        type: 'varchar', comment: '业务分类', length: 20,
        nullable: true, default: 'shop'
    })
    module!: string;

    @Tags({
        comment: '标签',
        nullable: true,
        default: []
    })
    tags!: string[];

    @Price({
        comment: '支付金额',
        nullable: true, default: 0
    })
    fee!: number;

    @Remark({
        comment: '备注', length: 255,
        nullable: true, default: ''
    })
    remark!: string;

    @MemberId({ type: 'uuid', comment: '会员编号' })
    mid!: string;

    @DateTime({
        comment: '支付时间',
        nullable: true
    })
    paytime!: Date;

    @DateTime({
        comment: '退款时间',
        nullable: true
    })
    refundtime!: Date;

    @Jsonb({ nullable: true })
    params: any;

    @CreateDate({
        comment: '创建日期'
    })
    create_date!: Date;

    @UpdateDate({
        comment: '更新日期'
    })
    update_date!: Date;
}